 {literal}
<script type="text/javascript">
$(document).ready(function(){	
    $('#testList{/literal}{$ticketId}{literal}').bind('click',function(){
    	{/literal}
    	var selected = $('#testList{$ticketId} :selected');
    	{literal}
    	if (selected != null) {
   		{/literal}
       		$('#testAssignDoctorName{$ticketId}').html(selected.attr('treatment_doctor_name'));
       		$('#testAssignDiagnosis{$ticketId}').html(selected.attr('diagnosis'));	    	
	    {literal}
    	}
    });

    $('#testList{/literal}{$ticketId}{literal}').bind('change',function(){
    	{/literal}
		var selected = $('#testList{$ticketId} :selected');
		{literal}
		if (selected != null) {
		{/literal}
		    $('#testAssignDoctorName{$ticketId}').html(selected.attr('treatment_doctor_name'));
		    $('#testAssignDiagnosis{$ticketId}').html(selected.attr('diagnosis'));          
		{literal}
         }
    });
    
    $('#testDel{/literal}{$ticketId}{literal}').bind('click',function(){
		{/literal}
		var selected = $('#testList{$ticketId} :selected');
		{literal}
		if (selected != null) {
		     delVitalSign({/literal}{$ticketId}{literal}, selected.attr('vitalSignId'));                
		}        
    });

    $('#createTestTicket{/literal}{$ticketId}{literal}').bind('click',function(){
	{/literal}      
		displayLabAssignment({$ticketId}, 'reloadLabAssignmentPanel{$ticketId}');
	{literal}        
    });

    $('#testAssignPrint{/literal}{$ticketId}{literal}').bind('click',function(){
		{/literal}
		var assignedTestTicketId = $('#testList{$ticketId} :selected').val();
		{literal}
		if (assignedTestTicketId != null && $.trim(assignedTestTicketId) != '') {
		    printAssignedTest({/literal}{$ticketId}{literal}, assignedTestTicketId);                
		}    
     });

	$('#testAssignViewEdit{/literal}{$ticketId}{literal}').bind('click',function(){
		{/literal}
		var testTicketId = $('#testList{$ticketId} :selected').val();	        	
		{literal}
		if (testTicketId != null && $.trim(testTicketId) != '') {
	    {/literal}
	    	displayLabAssignment4VEdit({$ticketId},testTicketId,'reloadLabAssignmentPanel{$ticketId}');          
	    {literal}
		}
	});

	$('#testAssignDel{/literal}{$ticketId}{literal}').bind('click',function(){
		{/literal}
		var labAssignmentTicketId = $('#testList{$ticketId} :selected').val();               
		{literal}
		if (labAssignmentTicketId != null && $.trim(labAssignmentTicketId) != '') {
			deleteLabAssignment('{/literal}{$ticketId}{literal}',labAssignmentTicketId);
		}
	});
   
});
</script>
{/literal}
<table class="inline" cellpadding="0" cellspacing="0" style='width: 100%'>
	<tr>
		<th colspan='2'>{translate}List of test ticket{/translate}</th>
		<td style='text-align: right;'>
			<a style="cursor: pointer" id="createTestTicket{$ticketId}" title="{translate}Create test ticket{/translate}">
				<img src="{$base_uri}/images/add_page.png"/>
			</a>
		</td>
		<td style='text-align: right; width: 50px;'>
			<div id="reloadTestAssign{$ticketId}" style="display:none;" align="right">
				<a style="cursor: pointer" id='reloadLabAssignmentPanel{$ticketId}' onclick="javascript:loadLabAssignPanel('{$ticketId}', '0');" title="{translate}Update list of patients{/translate}">
					<img border='0' src="{$base_uri}/images/refresh.png"/>
				</a>                      
            </div>
        	<div id="innerLoadingTestAssign{$ticketId}" style="display:block;" align="right">
				<img src="{$base_uri}/images/ajax-loader.gif"/>
			</div>
        </td>
	</tr>
	<tr>
		<td style='width: 280px;'>
			<span id="statusMessage{$ticketId}" style="font-style: italic; color: red;"></span><br/>
			<select style="width: 250px; height: 150px;" size="9" multiple="true" id="testList{$ticketId}" >
				{foreach from=$listOfLabAssignment item=assignedTest key=key}
				<option value = '{$assignedTest.lab_assignment_ticket_id}' request_time = '{$assignedTest.request_time}'
						diagnosis = '{$assignedTest.diagnosis}' ticket_id = '{$assignedTest.ticket_id}'
						treatment_doctor_name = '{$assignedTest.treatment_doctor_name}' treatment_doctor_id = '{$assignedTest.treatment_doctor_id}'
						enum_status = '{$assignedTest.enum_status}'>
						{$assignedTest.request_time}&nbsp;[{$assignedTest.enum_status_text}]
                </option>
				{/foreach}
			</select>
		</td>
		<td valign='top'>
			<div style='padding: 10px 0px 7px 0px;'>
				<span class="label">{translate}Doctor{/translate}:</span>&nbsp;
				<span id="testAssignDoctorName{$ticketId}" style="color: #000;"></span>
			</div>
			<div style='padding: 7px 0px;'>
				<span class="label">{translate}Diagnosis{/translate}:</span>
			</div>
			<div style='padding: 7px 0px;'>
				<textarea rows="3" style="width: 300px" id="testAssignDiagnosis{$ticketId}" readonly="readonly"></textarea>
			</div>
		</td>
		<td colspan='2'>&nbsp;</td>
	</tr>
	<tr>
		<td>
			<input type="button" id="testAssignViewEdit{$ticketId}" value="{translate}ViewEdit{/translate}" />
			<input type="button" id="testAssignDel{$ticketId}" value="{translate}Del{/translate}" />
			<input type="button" id="testAssignPrint{$ticketId}" value="{translate}Print{/translate}"/>
		</td>
		<td>
		</td>
		<td colspan='2'>&nbsp;</td>
	</tr>
	<tr>
		<td colspan='4'>
			<span id="resultMessage{$ticketId}" style="font-style: italic; color: red;"></span>
		</td>
	</tr>
</table>
<div id="labConnectorAssignment" style="display: none;"></div>